﻿using System;
using Iot.Shared.Enums;
using Iot.Shared.Path;

namespace Iot.RealTimeData.RealTimeData;

public interface IShowValue
{
    /// <summary>
    ///     路径
    /// </summary>
    DevicePath Path { get; }
}

public interface IShowValue<out T> : IShowValue
{
    /// <summary>
    ///     当前值
    /// </summary>

    T Value { get; }


    /// <summary>
    ///     数据变化事件
    /// </summary>
    event Action<T, DateTimeOffset>? ValueChanged;

    /// <summary>
    ///     接收到数据设置事件
    /// </summary>
    event Action<T, DateTimeOffset>? SetValueEvent;
}

public interface ISetValue<in T>
{
    /// <summary>
    ///     设置值
    /// </summary>
    /// <param name="value"></param>
    /// <param name="timeStamp"></param>
    void SetValue(T value, DateTimeOffset timeStamp);
}

public interface IOnSwitchingValue : ISwitchingValue, ISetValue<Switching?>;

public interface IOnEnumValue : IEnumValue, ISetValue<Enum?>;

public interface IOnFloatValue : IFloatValue, ISetValue<double?>;

public interface IOnIntegerValue : IIntegerValue, ISetValue<long?>;

//----------------------------------------------------------------

public interface IFloatValue : IShowValue<double?>;

public interface IIntegerValue : IShowValue<long?>;

public interface ISwitchingValue : IShowValue<Switching?>;

public interface IEnumValue : IShowValue<Enum?>;